#include "push.h"
#include <iostream>
#include <thread>
#include <chrono>

PushEndpoint::PushEndpoint(const std::string& address){
    context = zmq::context_t();
    sender = zmq::socket_t(context, zmq::socket_type::push);
    sender.bind(address);
}

void PushEndpoint::sendTask(const std::string& task) {
    sender.send(zmq::buffer(task), zmq::send_flags::none);
    std::cout << "Sent: " << task << std::endl;
    std::this_thread::sleep_for(std::chrono::seconds(1));  // 模拟任务间隔
}